﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace MyoSharp.HackNighter.Classes
{
    public class Animation
    {
        public UIElement GameElement;

        public bool Active { get; set; }
        public double PosX { get; set; }
        public double PosY { get; set; }
        public double VelX { get; set; }
        public double VelY { get; set; }

        public Animation(UIElement gameElement)
        {
            this.GameElement = gameElement;
            this.PosX = 0;
            this.Active = true;
        }

        public void Move()
        {
            if (!Active)
                return;

            this.PosX = PosX + VelX;
            this.PosY = PosY + VelY;
            Canvas.SetLeft(this.GameElement, PosX);

            if (PosY >= 90)
                VelY = -1 * VelY;

            if (PosY < 0)
            {
                PosY = 0;
                VelY = 0;
                Canvas.SetBottom(this.GameElement, PosY);
            }
            else
            {
                Canvas.SetBottom(this.GameElement, PosY);
            }
        }
    }
}
